package com.lekang.le.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.lekang.common.annotation.Log;
import com.lekang.common.core.controller.BaseController;
import com.lekang.common.core.domain.AjaxResult;
import com.lekang.common.enums.BusinessType;
import com.lekang.le.domain.CheckInManagement;
import com.lekang.le.service.ICheckInManagementService;
import com.lekang.common.utils.poi.ExcelUtil;
import com.lekang.common.core.page.TableDataInfo;

/**
 * 入住办理Controller
 * 
 * @author caoyangyang
 * @date 2025-10-14
 */
@RestController
@RequestMapping("/le/checkinmanagement")
public class CheckInManagementController extends BaseController
{
    @Autowired
    private ICheckInManagementService checkInManagementService;

    /**
     * 查询入住办理列表
     */
    @PreAuthorize("@ss.hasPermi('le:checkinmanagement:list')")
    @GetMapping("/list")
    public TableDataInfo list(CheckInManagement checkInManagement)
    {
        startPage();
        List<CheckInManagement> list = checkInManagementService.selectCheckInManagementList(checkInManagement);
        return getDataTable(list);
    }

    /**
     * 导出入住办理列表
     */
    @PreAuthorize("@ss.hasPermi('le:checkinmanagement:export')")
    @Log(title = "入住办理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, CheckInManagement checkInManagement)
    {
        List<CheckInManagement> list = checkInManagementService.selectCheckInManagementList(checkInManagement);
        ExcelUtil<CheckInManagement> util = new ExcelUtil<CheckInManagement>(CheckInManagement.class);
        util.exportExcel(response, list, "入住办理数据");
    }

    /**
     * 获取入住办理详细信息
     */
    @PreAuthorize("@ss.hasPermi('le:checkinmanagement:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(checkInManagementService.selectCheckInManagementById(id));
    }

    /**
     * 新增入住办理
     */
    @PreAuthorize("@ss.hasPermi('le:checkinmanagement:add')")
    @Log(title = "入住办理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody CheckInManagement checkInManagement)
    {
        return toAjax(checkInManagementService.insertCheckInManagement(checkInManagement));
    }

    /**
     * 修改入住办理
     */
    @PreAuthorize("@ss.hasPermi('le:checkinmanagement:edit')")
    @Log(title = "入住办理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody CheckInManagement checkInManagement)
    {
        return toAjax(checkInManagementService.updateCheckInManagement(checkInManagement));
    }

    /**
     * 删除入住办理
     */
    @PreAuthorize("@ss.hasPermi('le:checkinmanagement:remove')")
    @Log(title = "入住办理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(checkInManagementService.deleteCheckInManagementByIds(ids));
    }



}
